/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package WS;
import BD.Modulos.BdGui;
import Interfaces.BdException;
import Objects.ItemLeftBar;
import Objects.ItemPrintScreen;
import Objects.Sesion;
import java.sql.SQLException;
import javax.annotation.Resource;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.xml.ws.WebServiceContext;
/**
 *
 * @author armgarces
 */
@WebService(serviceName = "Gui")
public class Gui {
    @Resource
    WebServiceContext wsContext;
    /***************************************************************************/
    /******************************** TOOLBAR **********************************/
    /***************************************************************************/
    /**
     * 
     * @param sesion
     * @return 
     * @throws Interfaces.BdException 
     */
    @WebMethod(operationName = "loadMenu")
    public synchronized ItemLeftBar[] loadMenu(@WebParam(name = "sesion") Sesion sesion) throws BdException{        
        try{
            return BdGui.getInstance().loadMenu(sesion);
        }catch(BdException bde){
            throw bde;
        } catch (SQLException ex) {
        }
        return null;
    }
    /**
     * 
     * @param sesion
     * @param screen
     * @return
     * @throws BdException 
     */
    @WebMethod(operationName = "loadToolbar")
    public synchronized Integer[] loadToolBar(@WebParam(name = "sesion") Sesion sesion,
                                              @WebParam(name = "screen") int screen) throws BdException {
        try{
            return BdGui.getInstance().loadToolBar(sesion,screen);                         
        }catch(BdException bde){
            throw bde;
        } catch (SQLException ex) {
        }
        return null;
    }    
    /***************************************************************************/
    /****************************** PRINT SCREEN *******************************/
    /***************************************************************************/    
    /**
     * @author MITM
     * @param screen idScreen
     * @param obj idObjeto
     * @return 
     * @throws Interfaces.BdException 
     */
    @WebMethod(operationName = "findPrintScreen")
    public synchronized ItemPrintScreen[] findPrintScreen(@WebParam(name = "screen") int screen,
                                                          @WebParam(name = "obj") String obj) throws BdException {
        try{
            return BdGui.getInstance().findPrintScreen(screen,obj);      
        }catch(BdException bde){
            throw bde;
        } catch (SQLException ex) {
        }
        return null;
    }    
}
